let MatType = Float32Array;
function matricx_multiply(matricxA, colA, matricxB, colB){
    let ARow = Math.floor(matricxA.length / colA);
    let BRow = Math.floor(matricxB.length / colB);
    if (ARow != colB){
        throw "matricxA row not equal matricxB col";
    }
    let retMatricx = new MatType(ARow * colB);
    for (let i = 0; i < ARow; i++) {
        for (let j = 0; j < colB; j++) {
            let item = 0;
            for (let k = 0; k < colA; k++) {
                item += matricxA[i * colA + k] * matricxB[k * colB + j];                
            }
            retMatricx[i * colB + j] = item;
        }    
    }
    return retMatricx;
}

let test1 = new MatType(4);
test1[0] = 5;
test1[1] = 4;
test1[2] = 3;
test1[3] = 2;

let test2 = new MatType(4);
test2[0] = 2;
test2[1] = 2;
test2[2] = 1;
test2[3] = 3;

let ret = matricx_multiply(test1, 2, test2, 2);
console.log(ret);

